home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nejlepší hry
/
Nejlepsi hry.iso
/
hry
/
sea of chaos
/
sea_install.msi
/
_15C39AAA7726369D39812BD40F01CF6A
/
_61A9EFF1C1D040A4A10F2A8945E75148
< prev
next >
Wrap
Text File
|
2005-03-02
|
2KB
|
73 lines
//pixel shader to sample texture and environment map and mixes with material color
//combines a fixed bump image with a procedurally generated one for tiny ripples
//has projective reflections
//Luke Lenhart
//(C)2004-2005 Digipen Institute of Technology
//time since whenever
float time;
//magnitude of ripples (recommend from 0.75f to 1.5f)
float ripMag;
//base texture
//sampler sampTex;
//cube texture
sampler sampCube;
//projective reflection texture
sampler sampProjRefl;
//
struct PS_INPUT
{
//float2 Tex0 : TEXCOORD0;
float3 EnvTex : TEXCOORD1;
float4 Clr : COLOR;
float3 Pos : TEXCOORD2;
float4 ProjTxt : TEXCOORD3;
float CamDist : TEXCOORD4;
float CamDist2 : TEXCOORD5;
//float FogClr : TEXCOORD6;
};
float4 PShader(PS_INPUT In) : COLOR
{
//calc wave offset 0 and 1
float3 tmpW0sin, tmpW0cos;
sincos(2*time+In.Pos,tmpW0sin,tmpW0cos);
float3 normWave=sin(tmpW0sin+(In.Pos.y)/In.CamDist);
//combine waves to use as normal modifier
float3 normOff;
normOff.x=100*(sin(In.CamDist*0.1f)/In.CamDist)*(tmpW0sin.y);
normOff.y=100*(cos(In.CamDist*0.1f)/In.CamDist)*(tmpW0sin.x);
normOff.z=1.0f;
normOff*=ripMag*0.05f;
//calc proj text warp
float4 projTxtWaved=In.ProjTxt;
float2 projMod=sin(time*8.5f+In.CamDist*0.23f)*float2(0.5f,0.4f)*(10.0f/In.CamDist2);
projTxtWaved.xy=In.ProjTxt.xy+projMod;
//combine env map, color map sample, and projective texture sample
//float4 clrPlain=tex2D(sampTex,time+In.Tex0);
float4 clrEnv=texCUBE(sampCube,normOff+In.EnvTex);
float4 clrProjRefl=tex2Dproj(sampProjRefl,projTxtWaved);
float4 clr=float4(0.06f,0.135f,0.3f,0) + 0.85f*clrEnv + 0.6f*clrProjRefl;
//apply vert color
clr*=In.Clr;
//add fog color
//clr.xyz+=In.FogClr;
//set alpha from vert color
clr.a=In.Clr.a;
return clr;
}